﻿using Core.Common.Jwt;
using Core.DTO.System.SysPerson;
using Core.IService;
using Core.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Core.WebApi.Controllers.SystemControllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PersonController : ControllerBase
    {
        private readonly ISysPersonService service;
        private readonly IConfiguration configuration;

        public PersonController(ISysPersonService _service,IConfiguration _configuration)
        {
            service = _service;
            configuration = _configuration;
        }

        /// <summary>
        /// 根据部门id或人员姓名查询人员信息
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="name"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetList(int? orgId,string name="",int pageSize=8,int pageIndex=1)
        {
            int total;
            var list= service.GetList(orgId, name, pageSize, pageIndex, out total);
            return new JsonResult(new { list = list, total = total });
        }

        
    }
}
